home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swags_z.zip / TIMING.SWG / 0006_Timing Using TP Clock.pas < prev    next >
Pascal/Delphi Source File  |  1993-05-28  |  846b  |  40 lines

  1. {
  2. > Does anyone know of a proFiler For TP 6, or is there a special
  3. > command using TPC to activate a proFiler to tell how much time the
  4. > Program takes doing a task. Thanks, Luke
  5.  
  6. Try this Unit.  Put a ClockOn and it will start timing then when the ClockOff
  7. is reached it will tell you how long it took.  It's very nice For optimizing
  8. pieces of code.
  9. }
  10.  
  11. Unit Timer;
  12.  
  13. Interface
  14.  
  15. Procedure ClockOn;
  16. Procedure ClockOff;
  17.  
  18. Implementation
  19. Uses Dos;
  20.  
  21. Var
  22.   H, M, S, S100 : Word;
  23.   Startclock, Stopclock : Real;
  24.  
  25. Procedure ClockOn;
  26.  begin
  27.    GetTime(H, M, S, S100);
  28.    StartClock := (H * 3600) + (M * 60) + S + (S100 / 100);
  29. end;
  30.  
  31. Procedure ClockOff;
  32.  begin
  33.   GetTime(H, M, S, S100);
  34.   StopClock := (H * 3600) + (M * 60) + S + (S100 / 100);
  35.   WriteLn('Elapsed time = ', (StopClock - StartClock):0:2);
  36.  end;
  37.  
  38. end.
  39.  
  40.